home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
com
/
computer
/
casio_st
/
prog_fx
/
oisac2
/
l_5230.txt
< prev
next >
Wrap
Text File
|
1994-03-01
|
1KB
|
27 lines
5 ONERRORGOTO1000:DEFSEG=0
10 MODE8:DIM:c$=CHR$(5):n=2:x=0:ERASEa,b:m$="Lagrange's interpolation"
20 CLS:PRINTm$;TAB(0);"1:x 2:set data";
30 k=VAL(INPUT$(1,@)):ONk GOTO200,60
40 GOTO30
60 CLS:PRINT"Number of data";
70 s$="n":z=n:GOSUB500:n=z:IFw THEN20
75 IFn<2 ORn>200 ORFRACn<>0 THEN 70
80 DIMa(n),b(n):LOCATE15,0:PRINT"=";n;
110 FORi=1 TOn
120 s$="x"+MID$(STR$(i),2):z=a(i):GOSUB500:IFw THENIFi=1 THEN60 ELSEi=i-1 ELSEa(i)=z
130 s$="y"+MID$(STR$(i),2):z=b(i):GOSUB500:IFw THEN120 ELSEb(i)=z
140 NEXT:GOTO20
200 LOCATE0,1:PRINTc$;"x?";:INPUT@10;z$:LOCATE0,0:IFz$="" THEN20 ELSEx=VALF(z$)
220 c=0:FORi=1 TOn
230 p=1:FORj=1 TOn
240 IFi<>j THENp=p*(x-a(j))/(a(i)-a(j))
250 NEXT
260 c=c+p*b(i):NEXT
280 LOCATE12,1:PRINT":y=";STR$(c);:z$=INPUT$(1,@):GOTO200
500 LOCATE0,1:PRINTc$;s$;"=";z;"?";:INPUT@10;z:LOCATE0,0:w=PEEK(&H65B)-13:RETURN
1000 IFERR=1 THENCLS:ONERRORGOTO0
1010 IFERL=500 THENRESUME500
1020 IFERL=200 THENRESUME200
1030 IFERL=80 THENERASEa,b:RESUME80
1050 LOCATE0,1:PRINTc$;"not found";:z$=INPUT$(1,@):RESUME20